Text File Format
This section describes the text file format for to use in data import.
Sample import files are provided, located in directory: [Apis-Dir] sample files.
The text files are divided into two logical parts, a header and a body.
Header
The header declares all items into which you want to import data. It must contain enough information to create the items, if they don't exist. The header has 7 rows.
LineName | Description | Legal values |
---|---|---|
ColumnHeader | First line in the file. Defines how to interpret the column. 4 column types are: None - the column is neglected during parsing; Time - column contains time stamps; Quality - column contains quality information; Item - column contains time defines the item to import. | None Time Quality Item |
ItemID: | 2nd line in the file, contains item IDs in Item columns, otherwise ignored. | Legal Item IDs |
Vartype: | 3rd line in the file, contains the data type in Item columns, otherwise ignored. | VARTYPE, either as number or text |
Recordtype: | 4th line in the file, contains the item "RecordType" in Item columns, otherwise ignored. Sampled = 1; Sampled with quality = 2; Event based = 3. | 1 2 3 |
Resolution: | 5th line in the file, contains the item "Resolution" in Item columns, otherwise it's ignored. Specify as an integer in milliseconds | Integer |
HistoryLength: | 6th line in the file, contains the history length for the item in item columns, otherwise it's ignored. Specify as an integer in seconds | Integer |
Dimension: | 7th line in the file, this line is optional and should only be included when one or more of the items in file is vector/matrix. For import of only scalar items, omit this line. Specifies the dimension of a vector (N), or the size of a matrix (MxN) | N MxN |
The leftmost slots of line names, can be omitted in the file, but the semantics of the header are still the same. Omitting the line names makes editing the text file easier in applications like Excel etc, since then the header and body for an item then are placed in the same column. Otherwise, the header data is displaced one column to the right of its corresponding body data.
Body
The body of the text file defines the actual data to import. The contents of the columns in to body are interpreted differently, depending on the column type:
Column type | Description | Legal values |
---|---|---|
None | This type is provided to tell file interpreter to ignore the contents of this column. This is a nice feature when importing data from files generated by other software that may contain columns of no interest/meaning. | Anything |
Time | In this column, the timestamps of the data samples are specified. The first line must specify the timestamp of the first sample to import. The following rows for the item may contain either an exact timestamp, or a time difference in milliseconds from the previous timestamp. When specifying one difference, no further differences are necessary to specify unless the time difference between two samples changes. If a time column is left out for an item, the timestamps are taken from the last valid timestamp to the left of an item that was successfully interpreted. This means that if you import data having equal timestamps, you only have to specify one time column. The timestamps is parsed using the locale provided during the import wizard, and the format of the timestamps must match this. | timestamp difference |
Quality | In this column, the qualities of the samples are specified, when wanted. If no quality is specified, it defaults to good quality. When a quality is specified, it is valid for all the consecutive samples for that item, until a new quality is specified. Specify a quality as an integer value (either as a decimal or a hexadecimal), according to the OPC HDA and DA specifications. Bits 31–16 is OPC HDA Quality, bits 15–0 is OPC DA Quality, and all valid qualities are provided below. | integer |
Item | In this column, the actual data values for the items are specified. Each line must contain a string value that can be converted to the Vartype specified in the header of the item, using the locale provided during the import wizard. Typically, the decimal separator of the text data to import must match. | value string |